<template>
    <div>
        <FilterForm
            :data="salesData"
            label-width="85px"
            @search="searchData"
        />

        <Table ref="SorageTable" 
            :api="$Api.sales.delivery.list" 
            height="30vh"
            :selection="true" 
            @select="selectItem"
            @dbClick="dblclick"
        >
            <el-table-column
                label="供应商"
                align="center"
                prop="customerName"
                width="160"
            />
            <el-table-column
                label="单据日期"
                align="center"
                prop="billTime"
                width="100"
            />
            <el-table-column
                label="单据编号"
                align="center"
                prop="deliveryId"
                width="140"
            />
            <el-table-column
                label="车号"
                align="center"
                prop="carNo"
                width="120"
            />
            <el-table-column label="制单人" align="center" prop="createBy" />
            <el-table-column label="审核人" align="center" prop="auditor" />
            <el-table-column
                label="备注"
                align="center"
                prop="remark"
                width="200"
            />
        </Table>
    </div>
</template>

<script>

export default {
    data() {
        return {
           // 销售出库搜索参数
            salesData:[
                {
                    label: "客户",
                    name: "customerName",
                    type: "customer",
                },
                {
                    label: "单据日期",
                    type: "period_date",
                    st: "beginRegisterTime",
                    end: "endRegisterTime",
                    scale: 2,
                },
                
                { label: "单据编号", name: "returnId" },
            ], 
            selectTabelList: null,
            deliveryId: "",
            baleNumList: null,
            
            
        }
    },
    methods:{
        searchData(params) {
            let { SorageTable } = this.$refs;
            SorageTable.getData(params);
        },
        selectItem(row) {
            // let { selectTabelList,deliveryId } = this
            // selectTabelList = row
            // selectTabelList.map( (v) =>{
            //     deliveryId = v.deliveryId 
            // })
            // this.getDeliveryIdDetail(deliveryId)
        },
        dblclick(row) {
            let { deliveryId } = this
            deliveryId = row.deliveryId
            this.getDeliveryIdDetail(deliveryId)

        },
        // 查询包号详情
        getDeliveryIdDetail(deliveryId){
            let { baleNumList } = this;
            this.$Api.sales.delivery.inDetail( deliveryId ).then( (res)=>{
                baleNumList = res.data
                this.$parent.$emit('cancelClick',baleNumList)
            })
        },
        
    }
}
</script>